<template>
    <div>
       <table>
           <tr>
               <td>用户名</td>
               <td><input type="text" v-model="state.lname"/></td>
           </tr>
           <tr>
               <td>密码</td>
               <td><input type="password" v-model="state.lpwd" /></td>
           </tr>
           <tr>
               <td><input type="button" value="注册" @click="zhuce"></td>
           </tr>
       </table>
    </div>
</template>

<script setup lang="ts">
import { reactive, toRefs, onMounted} from 'vue' 
import { useRoute, useRouter } from 'vue-router'
import axios from 'axios'

const route = useRoute()
const router = useRouter()

const date = reactive({
  state:{
      lname:'',
      lpwd:''
  }

})

const {state} = toRefs(date)


const zhuce = () => {
    console.log(state.value);
    axios({
        url:'https://localhost:7144/api/Login/addLogin',
        method:'post',
        data:state.value

    }).then((res)=>{
        console.log(res)
        if(res.data.data>0){
            alert("成功")
        }
        else
        {
            alert("失败")
        }
    })
    .catch((err)=>{
        console.log(err)
    })
}



</script>

<style scoped>

</style>